<template>
  <div>
    <template v-if="type === 'radio'">
      单多选切换：
      <el-radio v-model="multiSelect" :label="false" @change="returnData(multiSelect)">
        切换单选
      </el-radio>
      <el-radio v-model="multiSelect" :label="true" @change="returnData(multiSelect)">
        切换多选
      </el-radio>
    </template>
    <template v-else-if="type === 'checkbox'">
      单多选切换：
      <el-radio v-model="multiSelect" :label="false">切换单选</el-radio>
      <el-radio v-model="multiSelect" :label="true">切换多选</el-radio>
    </template>
  </div>
</template>

<script>
  export default {
    props: {
      type: {
        type: String,
        default: ''
      },
      defaultMultiSelect: {
        type: Boolean,
        default: true
      }
    },
    data() {
      return {
        multiSelect: this.defaultMultiSelect
      }
    },
    methods: {
      returnData(data) {
        this.$emit('changeData', data)
      }
    }
  }
</script>
